<template>
	<view class="container">
		<view class="title">{{detail.releaseTitle}}</view>
		<view class="time">{{detail.releaseTime}}</view>
		<view class="content" v-html="detail.releaseContent"></view>
	</view>
</template>

<script setup>
	import {onMounted,ref} from 'vue';
	import {onLoad} from '@dcloudio/uni-app';
	//定义数组保存公告详情
	const detail = ref({
		releaseTitle: '关于元旦最新优惠政策通知',
		releaseTime: '2019.12.22',
		releaseContent: '关于元旦最新优惠政策通知...<br><view class="img"><image src="/static/img/logo.png" ></image></view>'
	})
	//一打开页面就加载通知
	onLoad((option) => {
		// console.log(option.id);
		loadNotice(option.id);
	})
	//定义加载公告的方法
	const loadNotice = (id) => {
		uni.request({
			url: BASE_URL+'/api/crm/notice/select?id='+id,
			success: (res) => {
				if (res.data.code == 2000) {
					detail.value = res.data.data[0];
				} else {
					uni.showToast({
						title: res.data.msg,
						icon: 'error'
					});
				}
			}
		});
	}
	
</script>

<style>
	page {
		padding: 50rpx 30rpx;
	}
	.title {
		margin-bottom: 30rpx;
	}
	.time {
		margin-bottom: 40rpx;
		font-size: 24rpx;
		color: #999;
	}
	.content {
		font-size: 28rpx;
		color: #666;
	}
</style>